<template>
  <div>
    <h1>列表</h1>
    <hr>
    <div v-for="n in 10" :key="n" style="border-bottom: 1px solid orange;">
      {{n}} <button @click="gotoDetail(n)">跳转到详情页</button>
    </div>
  </div>
</template>
<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

const gotoDetail = (id) => {
  router.push(`/detail/${id}`)
}

</script>